"use strict";
var DatePicker = /** @class */ (function () {
    function DatePicker(year, month) {
        this.year = year || this.getYear(new Date());
        this.month = month || this.getMonth(new Date());
        this.dateItems = this.getDateItem(this.year, this.month);
    }
    DatePicker.prototype.getDateItem = function (year, month) {
        var dateRule = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) {
            //  闰年 
            dateRule = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
        }
        var data = [];
        for (var index = 1; index <= dateRule[month]; index++) {
            data.push(index);
        }
        return data;
    };
    /**
     *  提取日期中的年份
     * @param date
     */
    DatePicker.prototype.getYear = function (date) {
        return new Date(date).getFullYear();
    };
    /**
     * 提取日期中的月份
     * @param date
     */
    DatePicker.prototype.getMonth = function (date) {
        return new Date(date).getMonth() + 1;
    };
    /**
     *
     * 获取传入的日期的相邻两个月的 日期表
     *
     * @param date
     */
    DatePicker.prototype.getSelfAndSiblingDate = function (date) {
        var month = this.getMonth(date);
        var year = this.getYear(date);
        if (month == 12) {
        }
        var data = {
            prev: {
                year: year,
                month: month - 1,
                day: this.getDateItem(year, month - 1)
            },
            current: {
                year: year,
                month: month,
                day: this.getDateItem(year, month)
            },
            next: {
                year: year,
                month: month + 1,
                day: this.getDateItem(year, month + 1)
            }
        };
        return data;
    };
    return DatePicker;
}());
var date = new DatePicker();
console.log(date);
